package com.example.hanfu_backend.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.hanfu_backend.entity.Cart;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

@Mapper
public interface CartMapper extends BaseMapper<Cart> {
    @Select("SELECT c.cart_id,c.customer_id,c.hanfu_id,c.cart_sum,c.cart_price,c.cart_size,h.hanfu_name,h.hanfu_image,h.hanfu_price,h.hanfu_inventory FROM cart c JOIN hanfu h ON c.hanfu_id = h.hanfu_id WHERE c.customer_id = #{customerId}")
    List<Map<String,Object>> getCartInfo(@RequestParam("customerId") Integer customerId);
}
